/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:岁亮亮
 * Date:2024-01-01
 * TIME:15:47
 */
public class J20240101 {
    public static void move(char par1,char par3){//汉诺塔
        System.out.print(par1+"->"+par3+" ");
        count++;
    }
    public static void hanio(int n,char par1,char par2,char par3){//汉诺塔
        if(n==1){
            move(par1,par3);
            return;
        }
        hanio(n-1,par1,par3,par2);
        move(par1,par3);
        hanio(n-1,par2,par1,par3);
    }
    public static int count=0;
    public static void main(String[] args) {    //汉诺塔
        hanio(1,'A','B','C');
        System.out.println(count);
        hanio(2,'A','B','C');
        System.out.println(count);
        hanio(3,'A','B','C');
        System.out.println(count);
        hanio(4,'A','B','C');
        System.out.println(count);


    }

}
